/**
 * @author theron
 */

/*获取当前时间*/
function getTime() {
	var today = new Date();
	var h = today.getHours();
	var m = today.getMinutes();
}

/*点赞事件*/
function goodClick(e) {//TODO 事件需要点击两次才显示？？
	var num = 1;
	with (e) {
		onclick = function() {
			innerHTML = "赞(" + num + ")";
			num++;
		};
	}
}

/*评论事件*/
function commentClick(e) {

}

/*显示评论文本域*/
function showTxtArea(e) {
	//alert("haswei");
	e.style.display = "none";
	document.getElementsByClassName('txtArea')[0].style.display = "block";
	document.getElementsByClassName('btn')[0].style.display = "block";
}

/*
*左边导航栏，鼠标事件
*/
//用于记录当前类名
var classname;
function ddColor() {

	//获取列表dd对象
	var ddNodes = document.getElementsByName('nav_dd');

	//获取dd所对应的内容模块div对象
	//var divNodes = document.getElementsByName('details');

	//对需要更改颜色的dd进行遍历
	for (var i = 0; i < ddNodes.length; i++) {

		//给dd添加鼠标事件(设置高亮效果)
		ddNodes[i].onmouseover = function() {
			classname = this.className;
			this.className = "over";
		};
		ddNodes[i].onmouseout = function() {
			this.className = classname;
		};

		/*??
		 ddNodes[i].onclick = function() {

		 //for(var j=0; j<i; j++){
		 //得到当前div的状态
		 var displayStyle = divNodes[j].style.display;
		 //alert(displayStyle);
		 if (displayStyle == "none") {
		 divNodes[j].style.display = "block";
		 }
		 divNodes[j].style.display = "none";
		 //}
		 };
		 */
	}
}

/*
 *	切换中间内容div的现实状态
 * */
function showDiv(id) {

	var div0 = document.getElementById('detail0');
	var div1 = document.getElementById('detail1');
	var div2 = document.getElementById('detail2');
	var div3 = document.getElementById('detail3');
	var div4 = document.getElementById('detail4');
	var div5 = document.getElementById('detail5');

	var divObj = document.getElementById(id);
	//alert(divObj.id);
	var objStyle = divObj.style.display;
	//alert(objStyle);
	if(objStyle=="none"){

		if (divObj == div0) {
			//alert(0);
			div1.style.display = "none";
			div2.style.display = "none";
			div3.style.display = "none";
			div4.style.display = "none";
			div5.style.display = "none";
			divObj.style.display = "block";

		} else if (divObj == div1) {
			//alert(1);
			divObj.style.display = "block";
			div0.style.display = "none";
			div2.style.display = "none";
			div3.style.display = "none";
			div4.style.display = "none";
			div5.style.display = "none";
		} else if (divObj == div2) {
			//alert(2);
			div1.style.display = "none";
			div0.style.display = "none";
			div3.style.display = "none";
			div4.style.display = "none";
			div5.style.display = "none";
			divObj.style.display = "block";
		} else if (divObj == div3) {
			//alert(3);
			div1.style.display = "none";
			div2.style.display = "none";
			div0.style.display = "none";
			div4.style.display = "none";
			div5.style.display = "none";
			divObj.style.display = "block";
		} else if (divObj == div4) {
			//alert(4);
			div1.style.display = "none";
			div2.style.display = "none";
			div3.style.display = "none";
			div0.style.display = "none";
			div5.style.display = "none";
			divObj.style.display = "block";
		} else {
			//alert(5);
			div1.style.display = "none";
			div2.style.display = "none";
			div3.style.display = "none";
			div4.style.display = "none";
			div0.style.display = "none";
			divObj.style.display = "block";
		}

	}

	/*
	 if(objStyle=="none"){
	 divObj.style.display="block";

	 }else{
	 divObj.style.display="none";
	 }

	 var divNodes = document.getElementsByName("details");

	 for(var i=0; i<divNodes.length; i++){
	 var disStyle = divNodes[i].style.display;

	 if(disStyle==objStyle ){
	 if(objStyle == "none"){
	 objStyle.style.display="block";
	 }
	 return;
	 }

	 }
	 }
	 */
}

